<%@ page language="java" pageEncoding="utf-8"%>
<%@taglib uri="/WEB-INF/page-base.tld" prefix="w"%>

<div class="easyui-panel" data-options="doSize:false,layoutH:47,border:false" style="margin:5px">
	<form method="post" action="/faretemp/FaretempPage@update.page" class="pageForm">
		<w:hidden bind="bean.id"/>
		<div class="ui-formContent">
			<p>
				<label style="width:100px;text-align:right">模板名称：</label>
				<w:text bind="bean.name" style="width:300px;" styleClass="easyui-validatebox" dataOptions="required:true"/>
			</p>
			<p>
				<label style="width:100px;text-align:right">运送方式：</label>
				<span>除指定地区外，其余地区的运费采用默认运费</span>
			</p>
			<div style="margin:2px 30px;">
			<w:checkbox bind="bean.way" value="1" text="物流"/>
			<table cellpadding="2" cellspacing="2">
			<tr>
				<td>默认运费：</td>
				<td><w:text bind="bean.startnum_default" style="width:80px" styleClass="easyui-numberbox" dataOptions="required:true"/></td>
				<td>件内，</td>
				<td><w:text bind="bean.startmoney_default" style="width:80px" styleClass="easyui-numberbox" dataOptions="required:true,min:0,precision:2,prefix:'￥'"/></td>
				<td>元，每增加</td>
				<td><w:text bind="bean.nextnum_default" style="width:80px" styleClass="easyui-numberbox" dataOptions="required:true"/></td>
				<td>件，增加运费</td>
				<td><w:text bind="bean.nextmoney_default" style="width:80px" styleClass="easyui-numberbox" dataOptions="required:true,min:0,precision:2,prefix:'￥'"/></td>
				<td>元</td>
			</tr>
			</table>
			<w:equal bind="bean.type" value="1">
				<table cellpadding="1" cellspacing="1" class="ui-table" data-options="showPage:false">
				<tr class="ui_th">
				<td align="center" width="300px">运送到指定地区</td>
				<td align="center" width="90px">首件（个）</td>
				<td align="center" width="90px">首运费（元）</td>
				<td align="center" width="90px">续件（个）</td>
				<td align="center" width="90px">续运费（元）</td>
				</tr>
				<tr class="ui_td">
				<td style="text-align:right;padding:5px">
					<div style="text-align:left" id="faretempareas"><ul></ul></div>
					<p style="margin:0px;padding:0px;clear:both"><a href="javascript:selfaretemparea();">添加指定区域</a></p>
				</td>
				<td><w:text bind="bean.startnum" style="width:90%"/></td>
				<td><w:text bind="bean.startmoney" style="width:90%"/></td>
				<td><w:text bind="bean.nextnum" style="width:90%"/></td>
				<td><w:text bind="bean.nextmoney" style="width:90%"/></td>
				</tr>
				</table>
			</w:equal>
			</div>
		</div>
	</form>
</div>

<div class="ui-buttonBar">
	<a href="javascript:;" class="easyui-linkbutton marginR16" iconCls="icon_save" onclick="$w.doWinForm();">保 存</a>
	<a href="javascript:;" class="easyui-linkbutton" iconCls="icon_cancel" onclick="$w.closeCurrWin()">取 消</a>
</div>
<script>
function selfaretemparea(){
	$w.openDialog({url:ctx+'/webadmin/faretemp/selAarea.jsp',title:"选择区域",w:400,h:200,afterClose:function(re){
		if(re){
			addfaretemparea(re.province,re.city);
		}
	}});
}
function addfaretemparea(p,c){
	$("#faretempareas ul").append('<li style="float:left;margin:0px 5px"><input name="bean.areas" type="checkbox" value="'+p+','+c+'" onclick="faretempareac(this)" checked>'+p+c+'</li>');
}
function faretempareac(obj){
	$(obj).parent().parent().remove();
}
</script>
<w:iterate bind="resultList_" id="info">
<script>addfaretemparea('<w:write bind="#info.province"/>','<w:write bind="#info.city"/>')</script>
</w:iterate>